import("//llvm/utils/TableGen/tablegen.gni")

tablegen("SystemZGenCallingConv") {
  visibility = [ ":LLVMSystemZCodeGen" ]
  args = [ "-gen-callingconv" ]
  td_file = "SystemZ.td"
}

tablegen("SystemZGenDAGISel") {
  visibility = [ ":LLVMSystemZCodeGen" ]
  args = [ "-gen-dag-isel" ]
  td_file = "SystemZ.td"
}

static_library("LLVMSystemZCodeGen") {
  deps = [
    ":SystemZGenCallingConv",
    ":SystemZGenDAGISel",
    "MCTargetDesc",
    "TargetInfo",
    "//llvm/include/llvm/Config:llvm-config",
    "//llvm/lib/Analysis",
    "//llvm/lib/CodeGen",
    "//llvm/lib/CodeGen/AsmPrinter",
    "//llvm/lib/CodeGen/SelectionDAG",
    "//llvm/lib/IR",
    "//llvm/lib/MC",
    "//llvm/lib/Support",
    "//llvm/lib/Target",
    "//llvm/lib/Transforms/Scalar",
  ]
  include_dirs = [ "." ]
  sources = [
    "SystemZAsmPrinter.cpp",
    "SystemZCallingConv.cpp",
    "SystemZConstantPoolValue.cpp",
    "SystemZCopyPhysRegs.cpp",
    "SystemZElimCompare.cpp",
    "SystemZFrameLowering.cpp",
    "SystemZHazardRecognizer.cpp",
    "SystemZISelDAGToDAG.cpp",
    "SystemZISelLowering.cpp",
    "SystemZInstrInfo.cpp",
    "SystemZLDCleanup.cpp",
    "SystemZLongBranch.cpp",
    "SystemZMCInstLower.cpp",
    "SystemZMachineFunctionInfo.cpp",
    "SystemZMachineScheduler.cpp",
    "SystemZPostRewrite.cpp",
    "SystemZRegisterInfo.cpp",
    "SystemZSelectionDAGInfo.cpp",
    "SystemZShortenInst.cpp",
    "SystemZSubtarget.cpp",
    "SystemZTDC.cpp",
    "SystemZTargetMachine.cpp",
    "SystemZTargetTransformInfo.cpp",
  ]
}

# This is a bit different from most build files: Due to this group
# having the directory's name, "//llvm/lib/Target/SystemZ" will refer to this
# target, which pulls in the code in this directory *and all subdirectories*.
# For most other directories, "//llvm/lib/Foo" only pulls in the code directly
# in "llvm/lib/Foo". The forwarding targets in //llvm/lib/Target expect this
# different behavior.
group("SystemZ") {
  deps = [
    ":LLVMSystemZCodeGen",
    "AsmParser",
    "Disassembler",
    "MCTargetDesc",
    "TargetInfo",
  ]
}
